-- UNITDEF -- turreta --
--------------------------------------------------------------------------------

local unitName = "turreta"

--------------------------------------------------------------------------------

local unitDef = {
  unitname               = [[turreta]],
  name                   = [[Gun Turret]],
  description            = [[Close Range Defenses]],
  acceleration           = 0,
  bmcode                 = [[0]],
  brakeRate              = 0,
  buildAngle             = 32768,
  buildCostEnergy        = 70,
  buildCostMetal         = 70,
  builder                = false,
  buildTime              = 70,
  canAttack              = true,
  canstop                = [[1]],
  category               = [[TARGET NOTINF TURRET]],
  collisionVolumeOffsets = [[0 3 0]],
  collisionVolumeScales  = [[48 108 48]],
  collisionVolumeTest    = 1,
  collisionVolumeType    = [[box]],
  corpse                 = [[DEAD]],
  explodeAs              = [[death]],
  footprintX             = 3,
  footprintZ             = 3,
  iconType               = [[turret]],
  idleAutoHeal           = 50,
  idleTime               = 100,
  levelGround            = true,
  mass                   = 35,
  maxDamage              = 2400, 
  maxSlope               = 36,
  maxVelocity            = 0,
  maxWaterDepth          = 0,
  minCloakDistance       = 150,
  noAutoFire             = false,
  noChaseCategory        = [[NOTARGET]],
  objectName             = [[Turreta.s3o]],
  seismicSignature       = 4,
  selfDestructAs         = [[death]],
 sfxtypes = {
    explosiongenerators = {
[[custom:flashmuzzle1]],
    },
  },
  sightDistance          = 800,  --pawn 800 engine 900
  smoothAnim             = true,
  TEDClass               = [[FORT]],
  turnRate               = 0,
  workerTime             = 0,
  yardMap                = [[oooo]],

  weapons                = {

    {
     def                = [[tawep1]],
	badTargetCategory  = [[NOTARGET]],
    onlyTargetCategory = [[TARGET]],
    },
    {
     def                = [[tawep2]],
	 weaponslaveto = 1,
	badTargetCategory  = [[NOTARGET]],
    onlyTargetCategory = [[TARGET]],
    },
	    {
     def                = [[tawep3]],
	 weaponslaveto3 = 1, --or is it this way? ie fbi 
	badTargetCategory  = [[NOTARGET]],
    onlyTargetCategory = [[TARGET]],
    },
	    {
     def                = [[tawep4]],
	badTargetCategory  = [[NOTARGET]],
    onlyTargetCategory = [[TARGET]],
    },
  },
}

local weaponDefs = {
tawep1 = {
	id                 = 1,
	avoidFriendly      = false,
    burst              = 5,
    burstrate          = .2,
    collideFriendly    = false,
    craterBoost        = 0,
    craterMult         = 0,
    duration           = .03,
    explosionGenerator = [[custom:none]],
    id                 = 1,
    impactonly         = 1,
    impulseBoost       = 0,
    impulseFactor      = 0,
    name               = [[Auto Cannon]],
    range              = 400,
    reloadtime         = 1,
    rgbColor           = [[1 .5 .2]],
    soundStart         = [[autocannon]],
    sprayAngle         = 800,
    thickness          = 0.5,
    tolerance          = 1000,
    turret             = true,
    weaponType         = [[LaserCannon]],
    weaponVelocity     = 1000,
	InterceptedByShieldType = 2,
    damage = {
      default            = 15,
			},
  },
 tawep2 = {
	id                 = 1,
	avoidFriendly      = false,
    burst              = 5,
    burstrate          = .2,
    collideFriendly    = false,
    craterBoost        = 0,
    craterMult         = 0,
    duration           = .03,
    explosionGenerator = [[custom:none]],
    id                 = 1,
    impactonly         = 1,
    impulseBoost       = 0,
    impulseFactor      = 0,
    name               = [[Auto Cannon]],
    range              = 400,
    reloadtime         = 1,
    rgbColor           = [[1 .5 .2]],
    soundStart         = [[autocannon]],
    sprayAngle         = 800,
    thickness          = 0.5,
    tolerance          = 1000,
    turret             = true,
    weaponType         = [[LaserCannon]],
    weaponVelocity     = 1000,
	InterceptedByShieldType = 2,
    damage = {
      default            = 15,
			},
  },

  tawep3 = {
	name = [[Small Missiles]], 
	id         = 1,
	rendertype = 1,
	lineofsight = 1,
	turret = 1,
	ballistic = 0,
	smoketrail = 1,
	smokedelay = .1,
	model = [[srocket.s3o]],
	collideFriendly     =  false,
	accuracy = 3200,
	range = 550,
	wobble = 1000,
	reloadtime = 3,
	burst = 2,
	burstrate = 0.4,
	areaofeffect = 20,
	weapontimer = 5,
	weaponvelocity = 650,
	startvelocity = 350,
	weaponacceleration = 320,
	turnrate = 1000, --counter wobble?
	metalpershot = 0,
    energypershot = 0,	
	soundstart = [[Rocket]],
	soundhit = [[medexplo]],
	soundTrigger = 1,
	firestarter = 70,
	guidance = 1,
	tracks = 1,
	selfprop = 1,
	tolerance = 1000,
	explosiongenerator = [[custom:SMALLMISSILE_EXPLOSION]],
	impulsefactor = 0,
	impulseBoost = 0,
	craterMult = 0,
	craterBoost = 0,
	startsmoke = 1,
	InterceptedByShieldType = 2,

    damage = {
      default            = 90,
    },
  },
  
tawep4 = {
	name = [[Small Missiles]], 
	id         = 1,
	rendertype = 1,
	lineofsight = 1,
	turret = 1,
	ballistic = 0,
	smoketrail = 1,
	smokedelay = .1,
	model = [[srocket.s3o]],
	collideFriendly     =  false,
	accuracy = 3200,
	range = 550,
	wobble = 1000,
	reloadtime = 3,
	burst = 2,
	burstrate = 0.4,
	areaofeffect = 20,
	weapontimer = 5,
	weaponvelocity = 650,
	startvelocity = 350,
	weaponacceleration = 320,
	turnrate = 1000, --counter wobble?
	metalpershot = 0,
    energypershot = 0,	
	soundstart = [[Rocket]],
	soundhit = [[medexplo]],
	soundTrigger = 1,
	firestarter = 70,
	guidance = 1,
	tracks = 1,
	selfprop = 1,
	tolerance = 1000,
	explosiongenerator = [[custom:SMALLMISSILE_EXPLOSION]],
	impulsefactor = 0,
	impulseBoost = 0,
	craterMult = 0,
	craterBoost = 0,
	startsmoke = 1,
	InterceptedByShieldType = 2,

    damage = {
      default            = 90,
		},
  },
  
  }  
unitDef.weaponDefs = weaponDefs  ---need or wont load weapon list


local featureDefs = {
    DEAD  = {
      description      = [[Wreckage - turret]],
      blocking         = true,
      category         = [[corpses]],
      damage           = 1000,
      energy           = 0,
	--  featureDead      = [[HEAP]],
      featurereclamate = [[SMUDGE01]],
      footprintX       = 3,
      footprintZ       = 3,
      height           = [[20]],
      hitdensity       = [[100]],
      metal            = 0,
      object           = [[turret_heap.s3o]],
      reclaimable      = false,
      reclaimTime      = 0,
      world            = [[All Worlds]],
    },
	
  }
  unitDef.featureDefs = featureDefs

--------------------------------------------------------------------------------

return lowerkeys({ [unitName] = unitDef })

--------------------------------------------------------------------------------
